package com.scwatch.core.fulltext;

import com.scwatch.core.domain.Node;
import com.scwatch.core.listener.AbstractNodeListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * NodeFulltextListener
 * 
 * @author gjl
 * 
 */
@Component
public class NodeFulltextListener extends AbstractNodeListener {
	@Override
	public void postNodeSave(Node[] beans) {
		generator.addDocument(beans);
	}

	@Override
	public void postNodeUpdate(Node[] beans) {
		generator.updateDocument(beans);
	}


	@Override
	public void postNodeDelete(Node[] beans) {
		generator.deleteDocuments(beans);
	}


	private NodeFulltextGenerator generator;

	@Autowired
	public void setNodeFulltextGenerator(NodeFulltextGenerator generator) {
		this.generator = generator;
	}
}
